import components from '../../../layout/components';
<template>
  <el-form
    ref="userForm"
    :model="userInfo"
    label-width="120px"
    style="margin-left: 120px; margin-top: 30px"
    >=={{ name1 }}
    <el-form-item label="姓名:">
      <el-input v-model="userInfo.username" style="width: 300px" />
    </el-form-item>
    <el-form-item label="密码:">
      <el-input
        v-model="userInfo.password"
        type="password"
        style="width: 300px"
      />
    </el-form-item>

    <el-form-item>
      <el-button type="primary" @click="onUpDate">更新</el-button>
    </el-form-item>
  </el-form>
</template>
<script>
// import { getUserDetailById } from '@/api/user'
import mixin from '@/mixins'
import { saveUserDetailById } from '@/api/employees'
export default {
  mixins: [mixin],
  data() {
    return {
      userInfo: {
        username: '',
        password: ''
      },
      name1: 'rose'
    }
  },
  created() {
    this.getUser()
  },
  methods: {
    // async getUser() {
    //   const res = await getUserDetailById(this.$route.params.id)
    //   console.log(res, 5)
    //   this.userInfo = res.data
    // },
    async onUpDate() {
      try {
        const res = await saveUserDetailById(this.userInfo)
        this.$message.success('更新成功')
      } catch (error) {}
    }
  }
}
</script>